<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const user=new Proxy({name:"zs",age:30},{
            // 监听获取属性操作
            get(target,key){
                // 将get操作反射到原始对象上
                return Reflect.get(target,key);
            },
            // 监听设置属性操作
            set(target,key,value){  
                // 将set操作反射到原始对象上
                return Reflect.set(target,key,value);
            },
            // 监听删除属性操作
            deleteProperty(target,key){
                // 将删除操作反射到原始对象上
                return Reflect.deleteProperty(target,key);
            }
        });
        console.log(user.name);
        user.name='ls';
        delete user.age;
        console.log(user);
    </script>
</body>
</html>